﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Aulac.Client.Data.XmlQuery;
using Aulac.Global.Xml;
using Aulac.Global.Common;
using Aulac.Rsc.Bss.Tags;
using Aulac.Rsc.Bss;

namespace Aulac.Client.Data.Bss.Helper
{
    public class VchHelper
    {
        public static string GetVchNameOnServer(VchTypes pVchType)
        {
            ClientExecXmlQueryData query = new ClientExecXmlQueryData();
            query.SetRequestInfo(Verb.AulacVerb.DataQuery.QueryData, Verb.AulacVerb.DataQuery.Noun.AulacDataQuery);
            query.SetVchHeaderElm();
            string strQuery = string.Format("SELECT {0} ", tagItems.VchTypes.VchName);
            strQuery += string.Format(" FROM {0} ", TableNames.Dm_VchTypes);
            strQuery += string.Format(" WHERE {0} = @{0}", tagItems.VchTypes.VchTypeID);
            query.ObjQueryVchHeader.SqlQueryString = strQuery;
            query.ObjQueryVchHeader.AddValueParamFilterItem(tagItems.VchTypes.VchTypeID, tagItems.VchTypes.VchTypeID, pVchType);

            try
            {
                return XmlProcess.GetValueVchHeader(query.ExecureQueryData(), tagItems.VchTypes.VchName);
            }
            catch
            {
                return "";
            }
        }
    }
}
